MRECNO Function
Syntax
Description
Returns composite record number when printed.
Discussion
MRECNO() returns the record number for a composite record in a set. Composite records include fields from the primary table and all of its related children. Each one-to-many link will cause the primary record to repeat one or more times for each child record. The composite record count can therefore be very different from the primary table record count.
Example
Assume that an invoicing set consists of two tables. One holds the invoices ( INVOICE), and the other holds each invoice's line-items ( INV_ITEM ):
- INVOICE
- Description
- INV_NO
- CUST_ID and INV_TOTAL
- I100
C001 10.00
- I101
C003 25.50
- I102
C001 100.75
- I103
C004 32.50
- I104
C002 110.25
- I105
C005 98.35
- INV_ITEM
- >
- INV_NO
- AMOUNT
- I100
4.50
- I100
5.50
- I101
25.50
- I102
3.25
- I102
35.25
- I102
62.25
- I103
32.50
- I104
110.25
- I105
98.35
INVOICE is related to INV_ITEM through a one-to-many link on the INV_NO field. This produces the following composite records:
- # INV_NO, CUST_ID, INV_TOTAL, INV_NO, AMOUNT
- >
- 1------ I100------ C001------ 10.00------ I100------ 4.50
- 2------ I100------ C001------ 10.00------ I100------ 5.50
- 3------ I101------ C003------ 25.50------ I101------ 25.50
- 4------ I102------ C001------ 100.75----- I102------ 3.25
- 5------ I102------ C001------ 100.75----- I102------ 35.25
- 6------ I102------ C001------ 100.75----- I102------ 62.25
- 7------ I103------ C004------ 32.50
- 8------ I104------ C002------ 110.25----- I104------ 110.25
- 9 : 'I105\003c/td\003e' '\003ctd' valign=top style=;" valign=top>C005 : '98.35\003c/td\003e' '\003ctd' valign=top style=;" valign=top>I105 98.35
To print only the first five composite records in a report, use the following detail filter expression:
mrecno() <= 5
To break a report into groups of three records each, use the following group break expression:
int((mrecno() - 1) / 3)
Limitations
This function can only be used in a report.
See Also